/** 
 * 资源分类
 */

import request from '@/utils/request'

export interface SaveOrderUpdateInter {
  id?: number
  name: string
  sort: string
}

export const getResourceCategories = () => {
  return request({
    method: 'GET',
    url: '/boss/resource/category/getAll',
  });
}

/** 删除资源分类，如果资源分类下有资源，不允许删除 */
export const deleteResourceCategory = (id: number) => {
  return request({
    method: 'DELETE',
    url: `/boss/resource/category/${id}`,
  });
}

/** 保存或更新资源分类 */
export const saveOrderUpdate = (data: SaveOrderUpdateInter) => {
  return request({
    method: 'POST',
    url: '/boss/resource/category/saveOrderUpdate',
    data
  });
}